<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" %>
<%@ include file="/common/taglibs.jsp"%>
<html>
  <head>
    <title>jQuery Template JSP</title>
    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
	<script type="text/javascript">
		jQuery(function($) {
// 			alert('hello');
		});
		
		function getPerson() {
			//var url = 'json/json-test!searchPerson.action';
			var url = 'json2!searchPerson.action';
			var t = {person:{firstName:"bbb", gender:"dd"}, username:'user11', message:'msg'};

			console.log(JSON.stringify(t));
			jQuery.ajax({
				type:"POST",
				data:JSON.stringify(t),
				url: url,
				dataType: 'json',
				contentType: "application/json",
				success: function(data, textStatus, jqXHR) {
					alert(data);
				}
			});
		}


		function encodeTest() {
			var obj = {username:'cc', person:{firstName:'a', lastName:'b'}, array: ['b', 'c']};

			console.log(obj);
			console.log(JSON.stringify(obj));
			console.log(jQuery.param(obj));

			var arr = ['cc', ['b', 'c'], {firstName:'a', lastName:'b'}];

			console.log(arr);
			console.log(JSON.stringify(arr));
			console.log(jQuery.param(arr));
		}
		
	</script>
  </head>
  
  <body>
    <button onclick="encodeTest()">Serialized Obj</button>
    <button onclick="getPerson()">search person</button>
  </body>
</html>
